package com.cngphone.AnFetion;

import android.text.TextUtils;

import com.cngphone.AnFetion.tools.StrUtil;

public class FetionMessage {
	
	public enum MessageStatus {
		Normal,
		Sms,
		Failed
	}

	private String content;
	private FetionFriend sender;
	private String time;
	private MessageStatus status;

	public String getContent() {
		return content;
	}

	public FetionFriend getSender() {
		return sender;
	}

	public String getTime() {
		return time;
	}

	public MessageStatus getStatus() {
		return status;
	}

	public FetionMessage(FetionFriend sender, String message, MessageStatus status) {
		this.sender = sender;
		this.content = message;
		if (status != null)
			this.status = status;
		else
			this.status = MessageStatus.Normal;
		time = StrUtil.getDate();
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		if (sender != null)
			sb.append(sender.getName());
		switch (status) {
		case Normal: break;
		case Sms: sb.append("(短信)");break;
		case Failed: sb.append("(发送失败)");break;
		}
		sb.append(" 说(").append(time).append("):");
		if (content != null)
			sb.append("\n").append(content);
		return sb.toString();
	}
}
